package com.guiwu.caiguanlin.writeTest;

/**
 * 斐波那契数列
 * f(1) = f(2) = 1
 * f(n) = f(n-2) + f(n-1);
 * n>=3
 */
public class Fibonacci {


    public static void main(String[] args) {
        System.out.println(recursive(3));
    }

    //递归
    private static int recursive(int n) {
        if (n == 1 || n == 2) return 1;
        return recursive(n - 2) + recursive(n - 1);
    }
}
